class RechargeModel {
  int? channelId;
  String? channelName;
  int? channelType;
  String? tipMessage;
  List<GoodsItem>? goodsList;

  RechargeModel(
      {channelId,
        channelName,
        channelType,
        tipMessage,
        goodsList});

  RechargeModel.fromJson(Map<String, dynamic> json) {
    channelId = json['channel_id'];
    channelName = json['channel_name'];
    channelType = json['channel_type'];
    tipMessage = json['tip_message'];
    if (json['goods_list'] != null) {
      goodsList = <GoodsItem>[];
      json['goods_list'].forEach((v) {
        goodsList!.add(GoodsItem.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['channel_id'] = channelId;
    data['channel_name'] = channelName;
    data['channel_type'] = channelType;
    data['tip_message'] = tipMessage;
    if (goodsList != null) {
      data['goods_list'] = goodsList!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class GoodsItem {
  int? id;
  String? name;
  double? price;
  int? amount;
  int? reward;
  String? remark;

  GoodsItem(
      {id, name, price, amount, reward, remark});

  GoodsItem.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    price = double.parse(json['price'].toString());
    amount = json['amount'];
    reward = json['reward'];
    remark = json['remark'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['name'] = name;
    data['price'] = price;
    data['amount'] = amount;
    data['reward'] = reward;
    data['remark'] = remark;
    return data;
  }
}
